A common computer task is to perform operations on a disk-based database. These operations involve moving data from the database on disk into computer memory. While in the computer memory, a user will modify the data. Ideally, the modified data is written back into the database on disk. However, to minimize input/output (I/O) operations to disk, recently used pages or other partitions of data may be retained in buffers within computer memory.
FIG. 1a is a schematic block diagram of a computer using process local buffers that is typical of the prior art. In volatile memory 10 there are a number of user processes 32. To update data from the database 110 on disk 100, each user process 32 in the local process space 30 reads data from disk 100 into an unused local buffer 33a,33b. There is one Buffer Control Block (BCB) 31a,31b for each local buffer 33a,33b. The Buffer Control Blocks 31 act as proxies for the respective local buffers 33. The Buffer Control Blocks 31 contain information about the local buffers 33 and act as pointers to the local buffers 33. Once the data has been modified in the local buffer, the data can be written back to the database 110.
The normal performance of the local buffer approach where each user processes has its own buffer pool and manages them independently has certain disadvantages. Unnecessary database file reads are incurred because each process must read in all the pages it needs even though the same page may have been read by some other process on the same node. The additional reads and writes to disk waste I/O bandwidth. In addition, the use of local memory to hold multiple copies of data wastes memory.
It is desirable to share data in global buffer memory between user processes. One approach is to use a separate buffer manager process. All user requests for data from disk are executed by the buffer manager, instead of the requesting process. The buffer manager thus single threads the buffer operations and serializes all disk I/O operations for one database. The data is stored in the local address space of the buffer manager process. The data is thus centrally located and available to user processes.
FIG. 1b is a schematic block diagram of a computer using a buffer manager that is typical of the prior art. In memory 10 there are user processes 32 which are running concurrently. The user processes 32 do not access the database 110 directly. Also in the local process space 30, there is a buffer manager process 38, containing software instructions 37. In contrast to the local buffers of FIG. 1a, the buffer manager process 38 handles all database-related disk I/O so pages in buffers 39 can be shared by multiple users.
Although the buffer manager process 38 may reduce the amount of disk I/O and may reduce the number of duplicate copies of data in memory, the buffer manager process 38 introduces extra instruction overhead. In particular, the communication between processes is costly in terms of performance. In addition, a failure of the buffer manager process 38, unlike a failure of a user process of FIG. 1a, causes a loss of all database buffers 39.